#==============================================================================
# WRITE VARIABLE INTO A SPECIFIC LINE  [NOT FOR EXPORT]
#==============================================================================
WriteKeywordLine<-function(fs,ln,vs) { 
	#fs --> file string containing entire parameter file
	#ln --> line number to read
	#vs --> variable character string to insert
	comchar<-"!" #indicate comments
	splchar<-"=" #sparate variable name and content
	vecchar<-"," #separate vector elements
	
	#check is character string is vector or scalar
	if (length(vs) > 1) vs<-paste(vs,sep="",collapse=vecchar)
	line<-trim(fs[ln]) #assign line, but first remove leading/trailing blanks
	varname<-unlist(strsplit(line,splchar,fixed = TRUE))[1] #get variable name	
	line<-varname&splchar&vs
	fs[ln]<-line
	return(fs)
}